home *** CD-ROM | disk | FTP | other *** search
- /* btplace */
- #include <stdio.h>
- #include <btextern.h>
- int btplace (filhand, key)
- int filhand;
- char *key;
-
- {
- int i,j,k,occurs,node,klength;
- char *cp;
-
- /* clear stack */
- clear ();
-
- /* initialize keylength */
- klength = btfilar[filhand].keylen;
- occurs = (LBLEN - 1) / (klength + 3);
- node = btfilar[filhand].root;
- cp = (char *)btfilar[filhand].filbuf + (LBLEN - 1);
-
- do {
- ip1 = btfilar[filhand].filbuf;
- cp1 = btfilar[filhand].ikeyptr;
- j = 0;
- if ((i = btread (filhand, node)))
- BTSETCOD (filhand, node, i);
- while ((i = strcmp (cp1, "")) != 0
- && (k = strcmp (cp1, key)) == -1)
- {
- j++;
- cp1 += (klength + 1);
- };
- push (node);
- push (j);
- node = ip1[j];
- } while ((node != NULL) && (*cp != 'Y'));
- return (0);
- } /* end of btplace */